import React,{useState,useEffect} from 'react';
import ReactECharts from 'echarts-for-react';
import {$getAuthorityNum, $getSexNum} from "../../api/Demoapi";

const PieChart1 = () => {
    const [data,setData]=useState({});
    const getAuthorityNum=async ()=>{
        const response = await $getAuthorityNum({});
        console.log(response.data);
        setData(response.data);
    }
    useEffect(()=>{
        getAuthorityNum();
    },[])
    const option = {
        tooltip: {
            trigger: 'item'
        },
        legend: {
            top: '5%',
            left: 'center'
        },
        series: [
            {
                name: 'Access From',
                type: 'pie',
                radius: ['40%', '70%'],
                avoidLabelOverlap: false,
                label: {
                    show: false,
                    position: 'center'
                },
                emphasis: {
                    label: {
                        show: true,
                        fontSize: 40,
                        fontWeight: 'bold'
                    }
                },
                labelLine: {
                    show: false
                },
                data: [
                    { value: data.VerifiedCount, name: '认证' },
                    { value: data.UnverifiedCount
                        , name: '未认证' }
                ]
            }
        ]
    };

    return <ReactECharts option={option} style={{ height: '300px' }} />;
};

export default PieChart1;
